<?php
class Accounts extends CI_Model {

	function __construct()
	{
		parent::__construct();
	}
	
	//判断用户名是否唯一
	function usernameIsUnique($username){
		$this->db->where('user_name',$username);
		$query = $this->db->get('users');
		$rs=$query->result();
		if($rs)
			return false;
		else 	
			return true;
	}
	
	//判断邮箱是否唯一
	function emailIsUnique($email){
		$this->db->where('email',$email);
		$query = $this->db->get('users');
		$rs=$query->result();
		if($rs)
			return false;
		else
			return true;
	}
	
	//判断手机是否唯一
	function mobileIsUnque($mobile){
		$this->db->where('mobile',$mobile);
		$query = $this->db->get('users');
		$rs=$query->result();
		if($rs)
			return false;
		else
			return true;
	}
	
	//注册入库
	function registor($data){
		$this->db->insert('users', $data);
	}
}